package com.candy.lianxi.diliuzhang.app_key;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class App_keyMapper extends Mapper<LongWritable,Text, SortApp,Text > {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable,Text, SortApp,Text >.Context context) throws IOException, InterruptedException {
        String line=value.toString();
        String[] words=line.split("\t");
        /*int count=Integer.parseInt(words[1]);
        int time=Integer.parseInt(words[2]);
        int consume=Integer.parseInt(words[3]);*/
        SortApp app=new SortApp();
        app.setCount(Integer.parseInt(words[1]));
        app.setTime(Integer.parseInt(words[2]));
        app.setConsume(Integer.parseInt(words[3]));

        context.write(app,new Text(words[0]));
    }
}
